package com.example.accessingdatajpa;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;

/**
 * @author caiwl
 * @date 2021/6/8 16:03
 */
@Entity
public class TwoIdDemo {
    @EmbeddedId
    private TwoIdDemoKey id;

    public TwoIdDemo() {
    }

    public TwoIdDemo(TwoIdDemoKey id) {
        this.id = id;
    }

    public TwoIdDemoKey getId() {
        return id;
    }

    public void setId(TwoIdDemoKey id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return String.format(
                "TwoIdDemo[userId=%d, roleId=%d]",
                id.getUserId(), id.getRoleId());
    }
}
